package com.xnyzc.lhy.mis.service.impl.punishment;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.common.penum.EErrorCode;
import com.xnyzc.lhy.common.util.DateUtil;
import com.xnyzc.lhy.common.util.IDUtil;
import com.xnyzc.lhy.common.util.TokenUtil;
import com.xnyzc.lhy.mis.entity.driver.wallet.OaDWalletRecord;
import com.xnyzc.lhy.mis.entity.param.punishment.OaDUserPenaltyAddParam;
import com.xnyzc.lhy.mis.entity.param.punishment.OaDUserPenaltyImportParam;
import com.xnyzc.lhy.mis.entity.punishment.OaDUserPenalty;
import com.xnyzc.lhy.mis.entity.punishment.OaDUserPenaltyDetail;
import com.xnyzc.lhy.mis.entity.punishment.OaDUserPunishment;
import com.xnyzc.lhy.mis.entity.user.OaDUser;
import com.xnyzc.lhy.mis.mapper.driver.wallet.OaDWalletMapper;
import com.xnyzc.lhy.mis.mapper.driver.wallet.OaDWalletRecordMapper;
import com.xnyzc.lhy.mis.mapper.punishment.OaDUserPenaltyDetailMapper;
import com.xnyzc.lhy.mis.mapper.punishment.OaDUserPenaltyMapper;
import com.xnyzc.lhy.mis.mapper.punishment.OaDUserPunishmentMapper;
import com.xnyzc.lhy.mis.mapper.user.OaDUserMapper;
import com.xnyzc.lhy.mis.service.account.IOaDAccountAdjustmentService;
import com.xnyzc.lhy.mis.service.punishment.IOaDUserPunishmentService;
import com.xnyzc.lhy.mis.entity.driver.wallet.OaDWallet;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.*;

import static com.xnyzc.lhy.common.util.BasicDataUtil.isEmpty;

/**
 * <p>
 * 司机处罚内容表 服务实现类
 * </p>
 *
 * @author cuixiaojian
 * @since 2019-10-27
 */
@Service
public class OaDUserPunishmentServiceImpl extends ServiceImpl<OaDUserPunishmentMapper, OaDUserPunishment> implements IOaDUserPunishmentService {
    @Autowired
    OaDUserMapper oaDUserMapper;

    @Autowired
    OaDWalletMapper oaDWalletMapper;

    @Autowired
    OaDUserPunishmentMapper oaDUserPunishmentMapper;

    @Autowired
    OaDUserPenaltyDetailMapper oaDUserPenaltyDetailMapper;

    @Autowired
    IOaDAccountAdjustmentService iOaDAccountAdjustmentService;

    @Autowired
    OaDWalletRecordMapper oaDWalletRecordMapper;

    @Autowired
    OaDUserPenaltyMapper oaDUserPenaltyMapper;

    @Override
    @Transactional
    public Rv addDriverPenaltyList(List<OaDUserPenaltyAddParam> oaDUserPenaltyAddParams) {
        if(oaDUserPenaltyAddParams != null && oaDUserPenaltyAddParams.size()>0){
            OaDUserPunishment oaDUserPunishment = null;
            QueryWrapper<OaDUser> queryWrapper = new QueryWrapper();
            queryWrapper.eq(OaDUser.DRIVER_ID,oaDUserPenaltyAddParams.get(0).getDriverId());
            OaDUser oaDUser = oaDUserMapper.selectOne(queryWrapper);
            if(isEmpty(oaDUser)){
                return Rv.wrap(EErrorCode.noData,"此用户不存在，或者此用户已经删除");
            }
            QueryWrapper<OaDWallet> queryWrapper1 = new QueryWrapper();
            queryWrapper1.eq(OaDWallet.DRIVER_ID,oaDUserPenaltyAddParams.get(0).getDriverId());
            OaDWallet oaDWallet = oaDWalletMapper.selectOne(queryWrapper1);
            if(isEmpty(oaDWallet)){
                return Rv.wrap(EErrorCode.noData,"此用户不存在，或者此用户已经删除");
            }
            QueryWrapper<OaDUserPenaltyDetail> queryWrapper2 = new QueryWrapper();
            queryWrapper2.eq(OaDUserPenaltyDetail.DRIVER_ID,oaDUserPenaltyAddParams.get(0).getDriverId());
            queryWrapper2.eq(OaDUserPenaltyDetail.DETAIL_ID,oaDUserPenaltyAddParams.get(0).getPenaltyDetailId());
            OaDUserPenaltyDetail oaDUserPenaltyDetail = oaDUserPenaltyDetailMapper.selectOne(queryWrapper2);
            if(!isEmpty(oaDUserPenaltyDetail)){
                if(oaDUserPenaltyDetail.getWhetherPunishment().equals(1)){
                    return Rv.wrap(EErrorCode.noData,"此违规已进行处罚");
                }
                oaDUserPenaltyDetail.setWhetherPunishment(1);
                oaDUserPenaltyDetailMapper.updateById(oaDUserPenaltyDetail);
            }else {
                return Rv.wrap(EErrorCode.noData,"不存在此详情");
            }

            Date thawingTime = null;
            List<OaDUserPunishment> list = new ArrayList();
            for (OaDUserPenaltyAddParam oaDUserPenaltyAddParam : oaDUserPenaltyAddParams) {
                // （1.账号封禁 2.账户冻结 3.司机罚款 4.警告）
                oaDUserPunishment = new  OaDUserPunishment();
                oaDUserPunishment.setPunishmentId(IDUtil.nextId());
                oaDUserPunishment.setThawunlockId(IDUtil.nextId());
                oaDUserPunishment.setPenaltyDetailId(oaDUserPenaltyAddParam.getPenaltyDetailId());
                oaDUserPunishment.setDriverId(oaDUserPenaltyAddParam.getDriverId());
                oaDUserPunishment.setPunishmentStatus(oaDUserPenaltyAddParam.getPunishmentType());
                oaDUserPunishment.setCreateUser(TokenUtil.getTokenUserId());
                oaDUserPunishment.setCreateTime(new Date());
                Long sysUserId = TokenUtil.getTokenUserId();
                oaDUserPunishment.setPunishmentPeratorId(sysUserId);
                switch (oaDUserPenaltyAddParam.getPunishmentType()) {
                    case 1:
                        oaDUserPunishment.setPunishmentTitlesDeadline(oaDUserPenaltyAddParam.getPenaltyDays());
                        if(oaDUser.getThawingTime() != null && oaDUser.getThawingTime().compareTo(new Date()) >0){
                            thawingTime = DateUtil.dateAddDays(oaDUser.getThawingTime(),oaDUserPenaltyAddParam.getPenaltyDays());
                        }else{
                            thawingTime = DateUtil.dateAddDays(new Date(),oaDUserPenaltyAddParam.getPenaltyDays());
                        }
                        oaDUser.setThawingTime(thawingTime);
                        oaDUser.setAccountStatus(4);
                        oaDUserMapper.updateById(oaDUser);
                        break;
                    case 2:
                        oaDUserPunishment.setPunishmentAccountFrozen(oaDUserPenaltyAddParam.getPenaltyDays());
                        if(oaDWallet.getThawingTime() != null && oaDWallet.getThawingTime().compareTo(new Date())>0){
                            thawingTime = DateUtil.dateAddDays(oaDWallet.getThawingTime(),oaDUserPenaltyAddParam.getPenaltyDays());
                        }else{
                            thawingTime = DateUtil.dateAddDays(new Date(),oaDUserPenaltyAddParam.getPenaltyDays());
                        }
                        oaDWallet.setThawingTime(thawingTime);
                        oaDWallet.setLogonStatus(1);
                        oaDWalletMapper.updateById(oaDWallet);
                        break;
                    case 3:
                        oaDUserPunishment.setPunishmentFines(oaDUserPenaltyAddParam.getPenaltyAmount());
                        BigDecimal amount = oaDUserPenaltyAddParam.getPenaltyAmount().multiply(new BigDecimal(-1));

                        BigDecimal balance = oaDWallet.getCashBalance().add(amount);

                        oaDWallet.setWalletBalance(oaDWallet.getWalletBalance().add(amount));
                        int number = balance.signum();
                        if (number >= 0)
                        {
                            oaDWallet.setCashBalance(balance);
                        }
                        else
                        {
                            oaDWallet.setCashBalance(new BigDecimal(0));
                            oaDWallet.setFrozenBalance(
                                    oaDWallet.getFrozenBalance().add(balance));

                            //创建冻结金额记录表数据
                            iOaDAccountAdjustmentService.saveFreezeBalance(oaDWallet.getDriverId(), balance);
                        }
                        oaDWalletMapper.updateById(oaDWallet);
                        Date date = new Date();

                        //添加钱包明细表   类型10为司机账户调整   交易流水号规则 SJZHTZ + YYYYMMdd + 十位随机数
                        OaDWalletRecord oaDWalletRecord = new OaDWalletRecord();
                        oaDWalletRecord.setRecordId(IDUtil.nextId());
                        oaDWalletRecord.setDriverId(oaDWallet.getDriverId());
                        oaDWalletRecord.setAmount(amount);
                        oaDWalletRecord.setRecordType(11);
                        oaDWalletRecord.setTransactionTime(date);
                        oaDWalletRecord.setTransactionSerialNo(
                                "SJZHTZ" + DateUtil.getDateDay().replaceAll("-", "") +
                                        UUID.randomUUID().toString().replace("-", "").substring(0, 9));
                        oaDWalletRecord.setTag("lhy");
                        oaDWalletRecord.setCreateUser(TokenUtil.getTokenUserId());
                        oaDWalletRecord.setCreateTime(date);
                        oaDWalletRecord.setUpdateUser(TokenUtil.getTokenUserId());
                        oaDWalletRecord.setUpdateTime(date);
                        oaDWalletRecordMapper.insert(oaDWalletRecord);

                        //创建司机流水
                        iOaDAccountAdjustmentService.saveOaDBill("", amount, oaDWallet.getDriverId());
                        break;
                    case 4:
                        oaDUserPunishment.setWarningContent(oaDUserPenaltyAddParam.getWarningCopy());
                        break;
                }
                list.add(oaDUserPunishment);
            }
            oaDUserPunishmentMapper.insertOaDUserPunishmentList(list);

            //更新处罚次数
            if(list != null && list.size() > 0){
                QueryWrapper<OaDUserPenalty> oaDUserPenalty = new QueryWrapper<OaDUserPenalty>();
                oaDUserPenalty.eq(OaDUserPenalty.DRIVER_ID, list.get(0).getDriverId());
                List<OaDUserPenalty> oaDUserPenaltyList = oaDUserPenaltyMapper.selectList(oaDUserPenalty);
                if(oaDUserPenaltyList != null && oaDUserPenaltyList.size() == 1){
                    if(oaDUserPenaltyList.get(0).getCumulativeNumberPenalties() != null){
                        oaDUserPenaltyList.get(0).setCumulativeNumberPenalties(oaDUserPenaltyList.get(0).getCumulativeNumberPenalties() + list.size());
                    }else {
                        oaDUserPenaltyList.get(0).setCumulativeNumberPenalties(list.size());
                    }

                    //全部处罚，修改待处罚状态
                    if(oaDUserPenaltyList.get(0).getCumulativeNumberViolations() - oaDUserPenaltyList.get(0).getCumulativeNumberPenalties() <= 0){
                        oaDUserPenaltyList.get(0).setIsPenalty(0);
                    }

                    oaDUserPenaltyMapper.updateById(oaDUserPenaltyList.get(0));
                }
            }
        }
        return Rv.wrap(EErrorCode.success);
    }

    /**
     * 批量导入处罚信息
     **/
    @Override
    @Transactional
    public Rv importDriverPenaltyList(List<OaDUserPenaltyImportParam> oaDUserPenaltyImportParamList) {
        if(oaDUserPenaltyImportParamList == null || oaDUserPenaltyImportParamList.size() <=0){
            return Rv.wrap(EErrorCode.success);
        }

        Map<String, List<OaDUserPenaltyAddParam>> penaltyMap = new HashMap<String, List<OaDUserPenaltyAddParam>>();

        //根据导入id进行分组，拆分成不同类型的处罚列表
        for (OaDUserPenaltyImportParam oaDUserPenaltyImportParam : oaDUserPenaltyImportParamList) {
            List<OaDUserPenaltyAddParam> oaDUserPenaltyAddParam = this.convertPenaltyAddParam(oaDUserPenaltyImportParam);
            if(oaDUserPenaltyAddParam != null
                    && oaDUserPenaltyAddParam.size() > 0){
                if(penaltyMap.get(oaDUserPenaltyImportParam.getDriverId()) == null){
                    penaltyMap.put(oaDUserPenaltyImportParam.getDriverId(), oaDUserPenaltyAddParam);
                } else {
                    penaltyMap.get(oaDUserPenaltyImportParam.getDriverId()).addAll(oaDUserPenaltyAddParam);
                }
            }
        }

        for (List<OaDUserPenaltyAddParam> oaDUserPenaltyAddParams :penaltyMap.values()) {
            if (oaDUserPenaltyAddParams != null && oaDUserPenaltyAddParams.size() > 0) {
                OaDUserPunishment oaDUserPunishment = null;
                QueryWrapper<OaDUser> queryWrapper = new QueryWrapper();
                queryWrapper.eq(OaDUser.DRIVER_ID, oaDUserPenaltyAddParams.get(0).getDriverId());
                OaDUser oaDUser = oaDUserMapper.selectOne(queryWrapper);
                if (isEmpty(oaDUser)) {
                    return Rv.wrap(EErrorCode.noData, "此用户不存在，或者此用户已经删除");
                }
                QueryWrapper<OaDWallet> queryWrapper1 = new QueryWrapper();
                queryWrapper1.eq(OaDWallet.DRIVER_ID, oaDUserPenaltyAddParams.get(0).getDriverId());
                OaDWallet oaDWallet = oaDWalletMapper.selectOne(queryWrapper1);
                if (isEmpty(oaDWallet)) {
                    return Rv.wrap(EErrorCode.noData, "此用户不存在，或者此用户已经删除");
                }
                QueryWrapper<OaDUserPenaltyDetail> queryWrapper2 = new QueryWrapper();
                queryWrapper2.eq(OaDUserPenaltyDetail.DRIVER_ID, oaDUserPenaltyAddParams.get(0).getDriverId());
                queryWrapper2.eq(OaDUserPenaltyDetail.PUNISHMENT_TYPE, oaDUserPenaltyAddParams.get(0).getPenaltyType());
                queryWrapper2.eq(OaDUserPenaltyDetail.ORDER_NUMBER, oaDUserPenaltyAddParams.get(0).getOrderNo());
                OaDUserPenaltyDetail oaDUserPenaltyDetail = oaDUserPenaltyDetailMapper.selectOne(queryWrapper2);
                if (!isEmpty(oaDUserPenaltyDetail)) {
                    if (oaDUserPenaltyDetail.getWhetherPunishment().equals(1)) {
                        return Rv.wrap(EErrorCode.noData, "此违规已进行处罚");
                    }
                    oaDUserPenaltyDetail.setWhetherPunishment(1);
                    oaDUserPenaltyDetailMapper.updateById(oaDUserPenaltyDetail);
                } else {
                    return Rv.wrap(EErrorCode.noData, "不存在此详情");
                }

                Date thawingTime = null;
                List<OaDUserPunishment> list = new ArrayList();
                for (OaDUserPenaltyAddParam oaDUserPenaltyAddParam : oaDUserPenaltyAddParams) {
                    // （1.账号封禁 2.账户冻结 3.司机罚款 4.警告）
                    oaDUserPunishment = new OaDUserPunishment();
                    oaDUserPunishment.setPunishmentId(IDUtil.nextId());
                    oaDUserPunishment.setThawunlockId(IDUtil.nextId());
                    oaDUserPunishment.setPenaltyDetailId(oaDUserPenaltyDetail.getDetailId());
                    oaDUserPunishment.setDriverId(oaDUserPenaltyAddParam.getDriverId());
                    oaDUserPunishment.setPunishmentStatus(oaDUserPenaltyAddParam.getPunishmentType());
                    oaDUserPunishment.setCreateUser(TokenUtil.getTokenUserId());
                    oaDUserPunishment.setCreateTime(new Date());
                    Long sysUserId = TokenUtil.getTokenUserId();
                    oaDUserPunishment.setPunishmentPeratorId(sysUserId);
                    switch (oaDUserPenaltyAddParam.getPunishmentType()) {
                        case 1:
                            oaDUserPunishment.setPunishmentTitlesDeadline(oaDUserPenaltyAddParam.getPenaltyDays());
                            if (oaDUser.getThawingTime() != null && oaDUser.getThawingTime().compareTo(new Date()) > 0) {
                                thawingTime = DateUtil.dateAddDays(oaDUser.getThawingTime(), oaDUserPenaltyAddParam.getPenaltyDays());
                            } else {
                                thawingTime = DateUtil.dateAddDays(new Date(), oaDUserPenaltyAddParam.getPenaltyDays());
                            }
                            oaDUser.setThawingTime(thawingTime);
                            oaDUser.setAccountStatus(5);//5=封号中
                            oaDUserMapper.updateById(oaDUser);
                            break;
                        case 2:
                            oaDUserPunishment.setPunishmentAccountFrozen(oaDUserPenaltyAddParam.getPenaltyDays());
                            if (oaDWallet.getThawingTime() != null && oaDWallet.getThawingTime().compareTo(new Date()) > 0) {
                                thawingTime = DateUtil.dateAddDays(oaDWallet.getThawingTime(), oaDUserPenaltyAddParam.getPenaltyDays());
                            } else {
                                thawingTime = DateUtil.dateAddDays(new Date(), oaDUserPenaltyAddParam.getPenaltyDays());
                            }
                            oaDWallet.setThawingTime(thawingTime);
                            oaDWallet.setLogonStatus(1);
                            oaDWalletMapper.updateById(oaDWallet);
                            break;
                        case 3:
                            oaDUserPunishment.setPunishmentFines(oaDUserPenaltyAddParam.getPenaltyAmount());
                            BigDecimal amount = oaDUserPenaltyAddParam.getPenaltyAmount().multiply(new BigDecimal(-1));

                            BigDecimal balance = oaDWallet.getCashBalance().add(amount);

                            oaDWallet.setWalletBalance(oaDWallet.getWalletBalance().add(amount));
                            int number = balance.signum();
                            if (number >= 0)
                            {
                                oaDWallet.setCashBalance(balance);
                            }
                            else
                            {
                                oaDWallet.setCashBalance(new BigDecimal(0));
                                oaDWallet.setFrozenBalance(
                                        oaDWallet.getFrozenBalance().add(balance));

                                //创建冻结金额记录表数据
                                iOaDAccountAdjustmentService.saveFreezeBalance(oaDWallet.getDriverId(), balance);
                            }
                            oaDWalletMapper.updateById(oaDWallet);
                            Date date = new Date();

                            //添加钱包明细表   类型10为司机账户调整   交易流水号规则 SJZHTZ + YYYYMMdd + 十位随机数
                            OaDWalletRecord oaDWalletRecord = new OaDWalletRecord();
                            oaDWalletRecord.setRecordId(IDUtil.nextId());
                            oaDWalletRecord.setDriverId(oaDWallet.getDriverId());
                            oaDWalletRecord.setAmount(amount);
                            oaDWalletRecord.setRecordType(11);
                            oaDWalletRecord.setTransactionTime(date);
                            oaDWalletRecord.setTransactionSerialNo(
                                    "SJZHTZ" + DateUtil.getDateDay().replaceAll("-", "") +
                                            UUID.randomUUID().toString().replace("-", "").substring(0, 9));
                            oaDWalletRecord.setTag("lhy");
                            oaDWalletRecord.setCreateUser(TokenUtil.getTokenUserId());
                            oaDWalletRecord.setCreateTime(date);
                            oaDWalletRecord.setUpdateUser(TokenUtil.getTokenUserId());
                            oaDWalletRecord.setUpdateTime(date);
                            oaDWalletRecordMapper.insert(oaDWalletRecord);

                            //创建司机流水
                            iOaDAccountAdjustmentService.saveOaDBill("", amount, oaDWallet.getDriverId());
                            break;
                        case 4:
                            oaDUserPunishment.setWarningContent(oaDUserPenaltyAddParam.getWarningCopy());
                            break;
                    }
                    list.add(oaDUserPunishment);
                }
                oaDUserPunishmentMapper.insertOaDUserPunishmentList(list);

                //更新处罚次数
                if(list != null && list.size() > 0){
                    QueryWrapper<OaDUserPenalty> oaDUserPenalty = new QueryWrapper<OaDUserPenalty>();
                    oaDUserPenalty.eq(OaDUserPenalty.DRIVER_ID, list.get(0).getDriverId());
                    List<OaDUserPenalty> oaDUserPenaltyList = oaDUserPenaltyMapper.selectList(oaDUserPenalty);
                    if(oaDUserPenaltyList != null && oaDUserPenaltyList.size() == 1){
                        if(oaDUserPenaltyList.get(0).getCumulativeNumberPenalties() != null){
                            oaDUserPenaltyList.get(0).setCumulativeNumberPenalties(oaDUserPenaltyList.get(0).getCumulativeNumberPenalties() + list.size());
                        }else {
                            oaDUserPenaltyList.get(0).setCumulativeNumberPenalties(list.size());
                        }

                        //全部处罚，修改待处罚状态
                        if(oaDUserPenaltyList.get(0).getCumulativeNumberViolations() - oaDUserPenaltyList.get(0).getCumulativeNumberPenalties() <= 0){
                            oaDUserPenaltyList.get(0).setIsPenalty(0);
                        }

                        oaDUserPenaltyMapper.updateById(oaDUserPenaltyList.get(0));
                    }
                }
            }
        }


        return Rv.wrap(EErrorCode.success);
    }

    private List<OaDUserPenaltyAddParam> convertPenaltyAddParam(OaDUserPenaltyImportParam oaDUserPenaltyImportParam) {
        List<OaDUserPenaltyAddParam> oaDUserPenaltyAddParamList = new ArrayList<OaDUserPenaltyAddParam>();

        //警告=4
        if(StringUtils.isNoneEmpty(oaDUserPenaltyImportParam.getWarningCopy())){
            OaDUserPenaltyAddParam oaDUserPenaltyAddParam = new OaDUserPenaltyAddParam();
            oaDUserPenaltyAddParam.setDriverId(Long.parseLong(oaDUserPenaltyImportParam.getDriverId()));
            oaDUserPenaltyAddParam.setPunishmentType(4);
            oaDUserPenaltyAddParam.setPenaltyType(oaDUserPenaltyImportParam.getPenaltyType());
            oaDUserPenaltyAddParam.setWarningCopy(oaDUserPenaltyImportParam.getWarningCopy());
            oaDUserPenaltyAddParam.setOrderNo(oaDUserPenaltyImportParam.getOrderNo());
            oaDUserPenaltyAddParamList.add(oaDUserPenaltyAddParam);
        }

        //司机罚款=3
        if(oaDUserPenaltyImportParam.getPenaltyAmount() != null){
            OaDUserPenaltyAddParam oaDUserPenaltyAddParam = new OaDUserPenaltyAddParam();
            oaDUserPenaltyAddParam.setDriverId(Long.parseLong(oaDUserPenaltyImportParam.getDriverId()));
            oaDUserPenaltyAddParam.setPunishmentType(3);
            oaDUserPenaltyAddParam.setPenaltyType(oaDUserPenaltyImportParam.getPenaltyType());
            oaDUserPenaltyAddParam.setPenaltyAmount(new BigDecimal(oaDUserPenaltyImportParam.getPenaltyAmount()));
            oaDUserPenaltyAddParam.setOrderNo(oaDUserPenaltyImportParam.getOrderNo());
            oaDUserPenaltyAddParamList.add(oaDUserPenaltyAddParam);
        }

        //账户冻结=2
        if(oaDUserPenaltyImportParam.getPenaltyDays() != null && Integer.parseInt(oaDUserPenaltyImportParam.getPenaltyDays()) > 0){
            OaDUserPenaltyAddParam oaDUserPenaltyAddParam = new OaDUserPenaltyAddParam();
            oaDUserPenaltyAddParam.setDriverId(Long.parseLong(oaDUserPenaltyImportParam.getDriverId()));
            oaDUserPenaltyAddParam.setPunishmentType(2);
            oaDUserPenaltyAddParam.setPenaltyType(oaDUserPenaltyImportParam.getPenaltyType());
            oaDUserPenaltyAddParam.setPenaltyDays(Integer.parseInt(oaDUserPenaltyImportParam.getPenaltyDays()));
            oaDUserPenaltyAddParam.setOrderNo(oaDUserPenaltyImportParam.getOrderNo());
            oaDUserPenaltyAddParamList.add(oaDUserPenaltyAddParam);
        }

        //账号封禁=1
        if(StringUtils.isNoneEmpty(oaDUserPenaltyImportParam.getClosedUserDays())){
            OaDUserPenaltyAddParam oaDUserPenaltyAddParam = new OaDUserPenaltyAddParam();
            oaDUserPenaltyAddParam.setDriverId(Long.parseLong(oaDUserPenaltyImportParam.getDriverId()));
            oaDUserPenaltyAddParam.setPunishmentType(1);
            oaDUserPenaltyAddParam.setPenaltyType(oaDUserPenaltyImportParam.getPenaltyType());
            oaDUserPenaltyAddParam.setPenaltyDays(Integer.parseInt(oaDUserPenaltyImportParam.getClosedUserDays()));
            oaDUserPenaltyAddParam.setOrderNo(oaDUserPenaltyImportParam.getOrderNo());
            oaDUserPenaltyAddParamList.add(oaDUserPenaltyAddParam);
        }

        return oaDUserPenaltyAddParamList;
    }
}
